// filename: MainWndContent.h
// author: enic
// date: 2015-05-05

#pragma once

#include "import_others.h"

class MainWndContent : public juce::Component
					 , public juce::ListBoxModel
{
public:
	MainWndContent()
	{
		m_demoListBox.setModel (this);
		m_demoListBox.setColour (juce::ListBox::backgroundColourId, juce::Colour::greyLevel (0.3f));
		m_demoListBox.selectRow (0);
		addAndMakeVisible (m_demoListBox);
	}

	void resized()
	{
		juce::Rectangle<int> r (getLocalBounds());

		if (r.getWidth() > 600)
		{
			m_demoListBox.setBounds (r.removeFromLeft (210));
			m_demoListBox.setRowHeight (20);
		}
		else
		{
			m_demoListBox.setBounds (r.removeFromLeft (130));
			m_demoListBox.setRowHeight (30);
		}
	}

	int getNumRows(void)
	{
		return 3;
	}

	void paintListBoxItem(int rowNumber, juce::Graphics& g, int width, int height, bool rowIsSelected)
	{
		juce::AttributedString attr;
		attr.setJustification (juce::Justification::centredLeft);
		attr.append (_T("234"), juce::Font (13.0f), juce::Colours::white.withAlpha (0.9f));
		attr.draw (g, juce::Rectangle<int> (width + 10, height).reduced (6, 0).toFloat());
	}

protected:
	juce::ListBox m_demoListBox;
};